﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SilverPOP.Library.BusinessEntities;
using SilverPOP.Library.DataAccessLayer;
using SilverPOP.Library.Helpers;

namespace SilverPOP.Library.BusinessLogicLayer
{
    public partial class SilverPopAccountBLL
    {
       public SilverPopAccount GetSilverPopAccountByUserID(int userID)
       {
           SilverPopAccount silverpopAccount = (from
                                                    silverPOP
                                                in
                                                    _DatabaseContext.SilverPopAccounts
                                                where
                                                      (silverPOP.UserID == userID)
                                                  && (silverPOP.IsActive == true)
                                                select
                                                     silverPOP
                                                ).FirstOrDefault();

           if (silverpopAccount != null)
               return silverpopAccount;
           else
               return null;
       }

       public SilverPopAccount GetSilverPopDefaultAccount()
       {
           SilverPopAccount silverpopAccount = (from
                                                    silverPOP
                                                in
                                                    _DatabaseContext.SilverPopAccounts
                                                where
                                                  (silverPOP.IsActive == true)
                                                select
                                                     silverPOP
                                                ).FirstOrDefault();

           if (silverpopAccount != null)
               return silverpopAccount;
           else
               return null;
       }
    
    }//end class
}
